package com.example.jiankang.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.jiankang.R;
import com.example.jiankang.entity.Jiankang;
import java.util.List;

public class jiankangAdapter extends ArrayAdapter<Jiankang> {
    private int resourceId;

    public jiankangAdapter(Context context, int resource, List<Jiankang> objects) {
        super(context, resource, objects);
        this.resourceId = resource;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        Jiankang item = getItem(position);

        View view = LayoutInflater.from(getContext()).inflate(resourceId, parent, false);
        Button yangsheng = view.findViewById(R.id.button_yangsheng);
        TextView jianjie = view.findViewById(R.id.text_jianjie);
        yangsheng.setText(item.getTitle());
        jianjie.setText(item.getDescription());


        return view;
    }
}